'''
Don't Copy This Code, Try To Solve It By Yourself
'''
def Solve():
n, qs = map(int, input().split())
a = list(map(int, input().split()))
q = list(map(int, input().split()))
for i in q:
x=a.index(i)
print(x+1, end=" ")
a[:x+1]=[i]+a[:x]
if __name__ == "__main__":
Solve()
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,q;
cin>>n>>q;
vector<int> cards(n);
for (int i = 0; i < n; ++i) {
cin>>cards[i];
}
vector<int> queries(q);
for (int i = 0; i <q; ++i) {
cin>>queries[i];
}
for (int i = 0; i < q; ++i) {
auto it=std::find(cards.begin(), cards.end(),queries[i]);
int index=it-cards.begin();
cout<<index+1<<" ";
for (int j = index; j >=1; --j) {
swap(cards[j],cards[j-1]);
}
}
cout<<endl;
return 0;
}
1028B - Unnatural Conditions | 735B - Urbanization |
746C - Tram | 1278B - A and B |
1353D - Constructing the Array | 1269C - Long Beautiful Integer |
1076A - Minimizing the String | 913C - Party Lemonade |
1313A - Fast Food Restaurant | 681A - A Good Contest |
1585F - Non-equal Neighbours | 747A - Display Size |
285A - Slightly Decreasing Permutations | 515C - Drazil and Factorial |
1151E - Number of Components | 1151F - Sonya and Informatics |
556A - Case of the Zeros and Ones | 867A - Between the Offices |
1569A - Balanced Substring | 260A - Adding Digits |
1698C - 3SUM Closure | 1029B - Creating the Contest |
1421A - XORwice | 1029A - Many Equal Substrings |
1675D - Vertical Paths | 1271C - Shawarma Tent |
805A - Fake NP | 1163A - Eating Soup |
787A - The Monster | 807A - Is it rated |